using Common.Communal;
using MediatR;
using Scheduling.Api.Write.Application.Command.TeamMemberCommand;
using Scheduling.Services.TeamMembers;

namespace Scheduling.Api.Write.Application.CommandHandlers.TeamMemberHandler
{
    public class TeamMemberDelCommandHandler : IRequestHandler<TeamMemberDelCommand, ApiResult<int>>
    {
        public TeamMemberDelCommandHandler(ITeamMemberServices teamMember)
        {
            TeamMember = teamMember;
        }

        public ITeamMemberServices TeamMember { get; }

        public async Task<ApiResult<int>> Handle(TeamMemberDelCommand request, CancellationToken cancellationToken)
        {
            return await TeamMember.DeleteTeamMember(request.MemberId);
        }
    }
}
